package com.fingard.dsp.bank.reqrespobj.entrust;

import com.fingard.text.StringHelper;

import java.util.HashMap;

/**
 * 纯签约查询响应实体类
 */
public class RetAtsQueryEntrust {
    /**
     * 返回0代表业务调用成功，非0表示失败
     */
    public String respCode;

    /**
     * 如果不为空代表错误信息
     */
    public String respInfo;

    /**
     * 商户订单号
     */
    public String rdSeq;

    /**
     * 渠道方返回签约协议id
     */
    public String channelAuthCode = "";

    /**
     * 协议模板id
     */
    public String planId = "";

    /**
     * 签约协议号
     */
    public String authCode = "";

    /**
     * 协议签署时间
     */
    public String timeEntrustStart = "";

    /**
     * 协议到期时间
     */
    public String timeEntrustExpire = "";

    /**
     * 协议解约时间
     */
    public String timeDeEntrustStart = "";

    /**
     * 协议解约方式
     */
    public String deEntrustWay = "";

    /**
     * 协议状态
     */
    public String entrustState = "";

    /**
     * openid
     *
     * @param p_req
     */
    public String openId = "";

    /**
     * appid
     *
     * @param p_req
     */
    public String appId = "";

    public RetAtsQueryEntrust(ReqQueryEntrust p_req) {
        rdSeq = p_req.rdSeq;
    }

    public HashMap<String, String> getRetAtsHashMap() {
        HashMap<String, String> retMap = new HashMap<String, String>();
        retMap.put("RespCode", respCode);
        retMap.put("RespInfo", respInfo);
        retMap.put("RdSeq", rdSeq);
        if (StringHelper.hasAnyChar(channelAuthCode)) {
            retMap.put("ContractID", channelAuthCode);
        }
        if (StringHelper.hasAnyChar(planId)) {
            retMap.put("PlanID", planId);
        }
        if (StringHelper.hasAnyChar(authCode)) {
            retMap.put("ContractCode", authCode);
        }

        if (StringHelper.hasAnyChar(timeEntrustStart)) {
            retMap.put("ContractSignedTime", timeEntrustStart);
        }
        if (StringHelper.hasAnyChar(timeEntrustExpire)) {
            retMap.put("ContractExpiredTime", timeEntrustExpire);
        }
        if (StringHelper.hasAnyChar(timeDeEntrustStart)) {
            retMap.put("ContractTerminatedTime", timeDeEntrustStart);
        }
        if (StringHelper.hasAnyChar(deEntrustWay)) {
            retMap.put("ContractTerminationMode", deEntrustWay);
        }
        if (StringHelper.hasAnyChar(entrustState)) {
            retMap.put("ContractState", entrustState);
        }
        if (StringHelper.hasAnyChar(openId)) {
            retMap.put("OpenID", openId);
        }
        if (StringHelper.hasAnyChar(appId)) {
            retMap.put("appId", appId);
        }
        return retMap;
    }
}
